from django.urls import path
from rest_framework.routers import SimpleRouter
from rest_framework_simplejwt.views import (TokenObtainPairView,
                                            TokenRefreshView)

from .views import LoginViewSet, RegisterViewSet

router=SimpleRouter()
router.register("", LoginViewSet, 'login')
router.register("register", RegisterViewSet, 'register')


urlpatterns = [
    # 获取token用的路由
    path('api/token/', TokenObtainPairView.as_view(),
         name='token_obtain_pair'),
    # 刷新token用的路由
    path('api/token/refresh/',  TokenRefreshView.as_view(), name='token_refresh'),
]+ router.urls
